/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package au.csiro.nt.psdp.actions.ims;

/**
 *
 * @author Jingyu ZHNAG
 */
import au.csiro.nt.psdp.actions.PdspActionSupport;
import com.opensymphony.xwork2.Preparable;
import au.csiro.nt.psdp.manager.ImsManager;
import au.csiro.nt.psdp.model.Ims;
import java.util.List;
public class ViewImssAction extends PdspActionSupport{
    private ImsManager imsManager;
    private Ims ims;
    public ViewImssAction(){}
    public void prepare() throws Exception
    {
        if (getRequest().getMethod().equalsIgnoreCase("post"))
        {
            if (!"".equals(getRequest().getParameter("ims.imsid")))
            {
                System.out.println("User Action ID: " + getRequest().getParameter("ims.imsid"));
                // prevent failures on new
                imsManager.getIms(Integer.parseInt(getRequest().getParameter("ims.imsid")));
            }
        }
    }
    
    public List getImss()
    {
        String user = getRequest().getUserPrincipal().getName();
        List aa = imsManager.getImss(user);
        aa.toString();
        System.out.println(aa.size());
        return imsManager.getImss(user);
    }

    public void setImsManager(ImsManager imsManager)
    {
        this.imsManager = imsManager;
        this.imsManager.toString();
    }
    public ImsManager getImsManager()
    {
        return imsManager;
    }


    /**
     * @return the ims
     */
    public Ims getIms() {
        return ims;
    }

    /**
     * @param ims the ims to set
     */
    public void setIms(Ims ims) {
        this.ims = ims;
    }
}
